# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  def page_title
    @title ? "#{@title} - AFSMS" : "AFSMS"
  end
  
  def content_for?(name)
    instance_variable_get("@content_for_#{name.to_s}").present?
  end
  
  def js(*args)
    content_for(:js){ javascript_include_tag(args) }
  end
  
  def css(*args)
    content_for(:css){ stylesheet_link_tag(args) }
  end
  
  def body_layout_class
    if content_for?(:left_sidebar) and content_for?(:right_sidebar)
      'column-triple'
    elsif content_for?(:left_sidebar)
      'column-left'
    elsif content_for?(:right_sidebar)
      'column-right'
    else
      'column-single'
    end
  end
end
